package foundation.filter;


import javax.ws.rs.container.DynamicFeature;
import javax.ws.rs.container.ResourceInfo;
import javax.ws.rs.core.FeatureContext;

/**
 * @author futao
 * Created on 18-7-23-下午2:47.
 * 动态拦截
 * 适用范围较窄
 */
public class DynamicFilter implements DynamicFeature {

    @Override
    public void configure(ResourceInfo resourceInfo, FeatureContext featureContext) {
        /*满足请求的方法为say的时候进行拦截*/
        if ("say".equals(resourceInfo.getResourceMethod().getName())) {
            featureContext.register(AnnotationFilter.class);
        }
    }
}
